<?php

namespace App\Http\Resources\Mini\WechatFansResource;

use Illuminate\Http\Resources\Json\ResourceCollection;

class PlatformOwnerClassCollection extends ResourceCollection
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'data' => $this->collection->map(function ($item) {
                return [
                    'id' => $item->id,
                    'username' => $item->username,//用户名
                    'mobile' => $item->mobile,//手机号
                    'province' => $item->province,//省份
                    'city' => $item->city,//市
                    'area' => $item->area,//区域
                    'detail' => $item->detail,//详细地址
                    'community' => $item->community,//区域
                    'tower_id' => $item->tower_id,//楼栋
                    'element_id' => $item->element_id,//单元
                    'floor_id' => $item->floor_id,//楼层
                    'room_number' => $item->room_number,//房间号
                    'electricity_bill_balance' => $item->electricity_bill_balance,//电费余额
                    'water_bill_balance' => $item->water_bill_balance,//水费余额
                    'property_bill_balance' => $item->property_bill_balance,//物业费余额
                    'electric_id' => $item->electric_id,//电表id
                    'elc_code' => $item->elc_code,//电表编号
                    'water_id' => $item->water_id,//水表id
                    'water_code' => $item->water_code,//水表编号
                    'electric_plan_id' => $item->electric_plan_id,//电表缴费计划id
                    'water_plan_id' => $item->water_plan_id,//水表缴费计划id
                    'property_plan_id' => $item->property_plan_id,//物业费缴费id
                    'electric_alarm_id' => $item->electric_alarm_id,//电费报警方案id
                    'water_alarm_id' => $item->water_alarm_id,//水费报警方案
                    'property_alarm_id' => $item->property_alarm_id,//物业费缴费方案
                    'fatherId' => $item->fatherId,//代理商id
                    'unionid' => $item->unionid,//开放平台unionid
                    'user_img' => $item->user_img,//代付吗
                    'last_payment_time' => $item->last_payment_time,//最后支付时间
                    'electric_total' => $item->electric_total,//总电量
                    'first_login_time' => $item->first_login_time,//首次登陆时间
                    'create_time' => $item->create_time,
                    'update_time' => $item->update_time,
                ];
            }),
        ];
    }
}
